package com.cin.cma.server.pos.controller;

import com.cin.cma.common.model.ApiResponse;
import com.cin.cma.common.model.finixx.request.*;
import com.cin.cma.common.model.finixx.response.*;
import com.cin.cma.server.pos.service.IGoodsService;
import jakarta.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 *
 * @Date：2024/11/28 17:25
 */
@RestController
@RequestMapping("goods")

public class GoodsController {
    @Autowired
    private IGoodsService goodsService;

    /**
     * 卖品大类
     *
     * @param model
     * @return
     */
    @ResponseBody
    @PostMapping("getGoodsClass")

    public ApiResponse<PosBigClassResponse> getGoodsClass(@RequestBody @Valid PosBigClassRequest model) throws Exception {
        return ApiResponse.success(this.goodsService.goodsClass(model));
    }

    /**
     * 卖品列表
     *
     * @param model
     * @return
     */
    @ResponseBody
    @PostMapping("getGoodsList")

    public ApiResponse<PosGoodsResponse> getGoodsList(@RequestBody @Valid PosGoodsListRequest model) throws Exception {
        return ApiResponse.success(this.goodsService.goodsList(model));
    }

    /**
     * 热卖卖品
     *
     * @param model
     * @return
     */
    @ResponseBody
    @PostMapping("getGoodsHot")

    public ApiResponse<PosGoodsResponse> getGoodsHot(@RequestBody @Valid PosGoodsHotRequest model) throws Exception {
        return ApiResponse.success(this.goodsService.goodsHot(model));
    }

    /**
     * 卖品套餐
     *
     * @param model
     * @return
     */
    @ResponseBody
    @PostMapping("getGoodsPackage")

    public ApiResponse<PosGoodsPackageResponse> goodsPackage(@RequestBody @Valid PosGoodsPackageRequest model) throws Exception {
        return ApiResponse.success(this.goodsService.goodsPackage(model));
    }

    /**
     * 卖品套餐详情
     *
     * @param model
     * @return
     */
    @ResponseBody
    @PostMapping("getGoodsPackageDetails")

    public ApiResponse<PosPackageDetailsResponse> getGoodsPackageDetails(@RequestBody @Valid PosPackageDetailsRequest model) throws Exception {
        return ApiResponse.success(this.goodsService.goodsPackageDetails(model));
    }

    /**
     * 卖品套餐详情
     *
     * @param model
     * @return
     */
    @ResponseBody
    @PostMapping("getGoodsOrderInfo")

    public ApiResponse<PosOrderResponse> getGoodsOrderInfo(@RequestBody @Valid PosOrderRequest model) throws Exception {
        return ApiResponse.success(this.goodsService.getGoodsOrderInfo(model));
    }
}